atom
Library for serializing the Atom web content syndication format.
This crate requires Rustc version 1.57.0 or greater.
Usage
Add the dependency to your Cargo.toml
.
[]
= "0.12"
Or, if you want Serde include the feature like this:
[]
= { = "0.12", = ["with-serde"] }
The package includes a single crate named atom_syndication
.
extern crate atom_syndication;
Reading
A feed can be read from any object that implements the BufRead
trait or using the FromStr
trait.
use File;
use BufReader;
use Feed;
let file = open.unwrap;
let feed = read_from.unwrap;
let string = "<feed></feed>";
let feed = string..unwrap;
Writing
A feed can be written to any object that implements the Write
trait or converted to an XML string using the ToString
trait.
Example
use File;
use ;
use Feed;
let file = open.unwrap;
let feed = read_from.unwrap;
// write to the feed to a writer
feed.write_to.unwrap;
// convert the feed to a string
let string = feed.to_string;
Invalid Feeds
As a best effort to parse invalid feeds atom_syndication
will default elements declared as "required" by the Atom specification to an empty string.
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.